var sub = $('#sub');
console.log($('#wrongData').value);
function load() {
    $ajax({
        method: "GET",
        url: "http://123.57.207.22:8080/api/getcatch",
        success: function (result) {
            console.log(result);
            var z = result.data;
            for (var l = 0; l < z.length; l++) {
                $('#catch').append('<hr><div class="media"><div class="media-left media-middle"><img src="' + z[l].gCImg + '" class="media-object images" ></div><div class="media-body"><h4 class="media-heading">' + z[l].gName + '</h4><p>' + z[l].gIntro + '</p><button class="delet" onclick="delet(' + z[l].id + ')">删除</button></div></div>')
            }
        }
    })
}
$ajax({
    method: "GET",
    url: "http://123.57.207.22:8080/api/getcatch",
    success: function (result) {
        console.log(result);
        var z = result.data;
        for (var l = 0; l < z.length; l++) {
            $('#catch').append('<hr><div class="media"><div class="media-left media-middle"><img src="' + z[l].gCImg + '" class="media-object images" ></div><div class="media-body"><h4 class="media-heading">' + z[l].gName + '</h4><p>' + z[l].gIntro + '</p><button class="delet" onclick="delet(' + z[l].id + ')">删除</button></div></div>')
        }
    }
})
function delet(count) {
    $.post("http://123.57.207.22:8080/api/deletearticle",
        {
            // 提交时携带的参数
            id: count
            // workname:workname,
            // speakwork:speakwork,
            // inputfile:inputfile
        },
        // 回调函数,data是服务器返回的数据
        function (data, status) {
            var dataObj = data;//转换为json对象
            // dataObj.code是服务器返回的一个数据
            if (dataObj.code == 1) {
                location.href = "../html/managework.html";
            } else {
                alert(dataObj.msg)
                return;
            }
        });
}